//
//  UIView+Addline.m
//  FYDriver
//
//  Created by 于龙 on 15/10/3.
//  Copyright © 2015年 Foryou. All rights reserved.
//

#import "UIView+Addline.h"

@implementation UIView (Addline)

- (void)addlineAt:(CGFloat)y Color:(UIColor *)color {
    
    UIColor *c = color;
    if (!c) {
        c = [UIColor hexStringToColor:@"#eeeeee" alpha:1];
    }
    CALayer *layer = [CALayer new];
    layer.frame = CGRectMake(0, y, kScreenWidth, 0.5);
    layer.backgroundColor = c.CGColor;
    [self.layer addSublayer:layer];
}

- (void)addlineWithFrame:(CGRect)frame Color:(UIColor *)color {
    
    UIColor *c = color;
    if (!c) {
        c = [UIColor hexStringToColor:@"#eeeeee" alpha:1];
    }
    CALayer *layer = [CALayer new];
    layer.frame = frame;
    layer.backgroundColor = c.CGColor;
    [self.layer addSublayer:layer];
}

- (void)addlineAt:(CGFloat)y lineH:(CGFloat)h Color:(UIColor *)color {
    
    UIColor *c = color;
    if (!c) {
        c = [UIColor hexStringToColor:@"#eeeeee" alpha:1];
    }
    CALayer *layer = [CALayer new];
    layer.frame = CGRectMake(0, y-h, self.width, h);
    layer.backgroundColor = c.CGColor;
    [self.layer addSublayer:layer];
}

- (void)addVerticalLineAt:(CGRect)frame  Color:(UIColor *)color {
    
    UIColor *c = color;
    if (!c) {
        c = [UIColor hexStringToColor:@"#eeeeee" alpha:1];
    }
    CALayer *layer = [CALayer new];
    layer.frame = frame;
    layer.backgroundColor = c.CGColor;
    [self.layer addSublayer:layer];
}
@end
